<?php
/*
 * This is growth page for 6-12 years.
 */
include '../../include/config.php';
$q = mysql_query("select * from baby_612_growth where bid = '" . $_COOKIE['bid'] . "'");
$rp = $_SERVER['REQUEST_URI'];
if (mysql_num_rows($q) == 0) {
    echo 'not inserted any data...:P';
    ?>
    <form method="post" action="../child/child_612.php" >
        <input type="hidden" name="action" value="insert_612" />
        <input type="hidden" name="rp" value="<?php echo $rp; ?>" />
        <input type="submit" style="width: 200px; height: 40px; color: green; float: left; " value="Start Entry" />
    </form>
<?php } else {
    ?>

    <script>
        
        function wl(val, type){
            var type= document.getElementById(type).value;
            if(type=='kg')
            {
                var value = document.getElementById(val).value /2.2046;
                document.getElementById(val).value = value;
            }
            if(type=='lbs'){
                var value = document.getElementById(val).value * 2.2046;
                document.getElementById(val).value = value;
            }
        }

        function fc(val,type){
            var type= document.getElementById(type).value;
            if(type=='cm'){
                var value = document.getElementById(val).value / 0.03;           
                document.getElementById(val).value= value;
                //  alert('cm selected. \nCM ='+value);
            }
            if(type=='ft')
            {
                var value = document.getElementById(val).value * 0.03;           
                document.getElementById(val).value= value;
                //    alert('evaluating foot');
            }        
        }  


    </script>
    <?php while ($row = mysql_fetch_array($q)) { ?>
        <form method="post" action="../child/child_612.php" >
            <table style="width: 600px; border-collapse: collapse; " border="1" >
                <tr style="height: 100px;" >
                    <th style="width: 100px; " >AGE</th>
                    <th style="width: 125px;">WEIGHT</th>
                    <th style="width: 125px;">LENGTH</th>
                    <th style="width: 150px;">KIND OF FEEDING</th>
                </tr>

                <tr style="height: 100px;">
                    <th>6 YEAR</th>
                    <td>
                <center>
                    <input type="text" size="5" name="1" id="6m0v" value="<?= $row[1] ?>" />
                    <select name="2" style="width: 2;" id="6m0t" onchange="wl('6m0v','6m0t')" >
                        <option value="kg" <?php if ($row[2] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[2] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="3" id="6m1v" value="<?= $row[3] ?>" />
                    <select name="4" id="6m1t" onchange="fc('6m1v','6m1t')" >
                        <option value="cm" <?php if ($row[4] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft"<?php if ($row[4] == 'ft') { ?> selected="selected"  <?php } ?> >ft</option>
                    </select>
                </center>
                </td>

                <td>
                    <textarea name="5" cols="20" rows="5" ><?= $row[5] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>7 YEAR</th>
                    <td>
                <center>
                    <input type="text" size="5" name="6" id="7m0v" value="<?= $row[6] ?>" />
                    <select name="7" style="width: 2;" id="7m0t" onchange="wl('7m0v','7m0t')" >
                        <option value="kg" <?php if ($row[7] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[7] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="8" id="7m1v" value="<?= $row[8] ?>" />
                    <select name="9" id="7m1t" onchange="fc('7m1v','7m1t')" >
                        <option value="cm" <?php if ($row[9] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[9] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>

                <td>
                    <textarea name="10" cols="20" rows="5" ><?= $row[10] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>8 YEAR</th>
                    <td>
                <center>
                    <input type="text" size="5" name="11" id="8m0v" value="<?= $row[11] ?>" />
                    <select name="12" style="width: 2;" id="8m0t" onchange="wl('8m0v','8m0t')" >
                        <option value="kg" <?php if ($row[12] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs"<?php if ($row[12] == 'lbs') { ?> selected="selected"  <?php } ?> >Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="13" id="8m1v" value="<?= $row[13] ?>" />
                    <select name="14" id="8m1t" onchange="fc('8m1v','8m1t')" >
                        <option value="cm" <?php if ($row[14] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[14] == 'ft') { ?> selected="selected"  <?php } ?> >ft</option>
                    </select>
                </center>
                </td>

                <td>
                    <textarea name="15" cols="20" rows="5" ><?= $row[15] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>9 YEAR</th>
                    <td>
                <center>
                    <input type="text" size="5" name="16" id="9m0v" value="<?= $row[16] ?>" />
                    <select name="17" style="width: 2;" id="9m0t" onchange="wl('9m0v','9m0t')" >
                        <option value="kg" <?php if ($row[17] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[17] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="18" id="9m1v" value="<?= $row[18] ?>"/>
                    <select name="19" id="9m1t" onchange="fc('9m1v','9m1t')" >
                        <option value="cm" <?php if ($row[19] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[19] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>

                <td>
                    <textarea name="20" cols="20" rows="5" ><?= $row[20] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>10 YEAR</th>
                    <td>
                <center>
                    <input type="text" size="5" name="21" id="10m0v" value="<?= $row[21] ?>"/>
                    <select name="22" style="width: 2;" id="10m0t" onchange="wl('10m0v','10m0t')" >
                        <option value="kg" <?php if ($row[22] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[22] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="23" id="10m1v" value="<?= $row[23] ?>"/>
                    <select name="24" id="10m1t" onchange="fc('10m1v','10m1t')" >
                        <option value="cm" <?php if ($row[24] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[24] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>

                <td>
                    <textarea name="25" cols="20" rows="5" ><?= $row[25] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>11 YEAR</th>
                    <td>
                <center>
                    <input type="text" size="5" name="26" id="11m0v" value="<?= $row[26] ?>"/>
                    <select name="27" style="width: 2;" id="11m0t" onchange="wl('11m0v','11m0t')" >
                        <option value="kg" <?php if ($row[27] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[27] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="28" id="11m1v" value="<?= $row[28] ?>"/>
                    <select name="29" id="11m1t" onchange="fc('11m1v','11m1t')" >
                        <option value="cm" <?php if ($row[29] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[29] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>

                <td>
                    <textarea name="30" cols="20" rows="5" ><?= $row[30] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>12 YEAR</th>
                    <td>
                <center>
                    <input type="text" size="5" name="31" id="12m0v" value="<?= $row[31] ?>"/>
                    <select name="32" style="width: 2;" id="12m0t" onchange="wl('12m0v','12m0t')" >
                        <option value="kg" <?php if ($row[32] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[32] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>

                <td>
                <center>
                    <input type="text" size="5" name="33" id="12m2v" value="<?= $row[33] ?>"/><br/>
                    <select name="34" id="12m2t" onchange="fc('12m2v','12m2t')" >
                        <option value="cm" <?php if ($row[34] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[34] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="35" cols="20" rows="5" ><?= $row[35] ?></textarea>
                </td>
                </tr>
            </table>
                        <input type="hidden" name="sr" value="<?php echo $row['sr']; ?>" />
            <input type="hidden" name="action"  value="update612" />
            <input type="hidden" name="rp" value="<?php echo $rp; ?>" />
            <input type="submit" style="width: 200px; height: 40px; color: green; float: left; " value="UPDATE" />
        </form>
        <?php }
    }
    ?>